package com.cw.base.common.dispatch.event;

import java.util.concurrent.Executors;

import com.cw.base.common.dispatch.listening.MessageListening;
import com.google.common.eventbus.AsyncEventBus;
import com.google.common.eventbus.EventBus;

/**
 * 事件的封装<br>
 * Created on 15/11/10.
 *
 * @author zhangcheng
 */
public class EventWrapper<E> {

    private EventBus eventBus;

    public EventWrapper(MessageListening listen) {
        eventBus = new AsyncEventBus(Executors.newCachedThreadPool());
        this.eventBus.register(listen);
    }

    public void post(E event) {
        this.eventBus.post(event);
    }

}
